3.493 \(\int (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^n \, dx\)

Optimal. Leaf size=98 \[ \frac {2 i a^2 (a+i a \tan (c+d x))^{n-2} (e \sec (c+d x))^{4-2 n}}{d \left (n^2-5 n+6\right )}+\frac {i a (a+i a \tan (c+d x))^{n-1} (e \sec (c+d x))^{4-2 n}}{d (3-n)} \]

[Out]

2*I*a^2*(e*sec(d*x+c))^(4-2*n)*(a+I*a*tan(d*x+c))^(-2+n)/d/(n^2-5*n+6)+I*a*(e*sec(d*x+c))^(4-2*n)*(a+I*a*tan(d
*x+c))^(-1+n)/d/(3-n)

________________________________________________________________________________________

Rubi [A]  time = 0.13, antiderivative size = 98, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 30, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.067, Rules used = {3494, 3493} \[ \frac {2 i a^2 (a+i a \tan (c+d x))^{n-2} (e \sec (c+d x))^{4-2 n}}{d \left (n^2-5 n+6\right )}+\frac {i a (a+i a \tan (c+d x))^{n-1} (e \sec (c+d x))^{4-2 n}}{d (3-n)} \]

Antiderivative was successfully verified.

[In]

Int[(e*Sec[c + d*x])^(4 - 2*n)*(a + I*a*Tan[c + d*x])^n,x]

[Out]

((2*I)*a^2*(e*Sec[c + d*x])^(4 - 2*n)*(a + I*a*Tan[c + d*x])^(-2 + n))/(d*(6 - 5*n + n^2)) + (I*a*(e*Sec[c + d
*x])^(4 - 2*n)*(a + I*a*Tan[c + d*x])^(-1 + n))/(d*(3 - n))

Rule 3493

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(2*b*
(d*Sec[e + f*x])^m*(a + b*Tan[e + f*x])^(n - 1))/(f*m), x] /; FreeQ[{a, b, d, e, f, m, n}, x] && EqQ[a^2 + b^2
, 0] && EqQ[Simplify[m/2 + n - 1], 0]

Rule 3494

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*(d
*Sec[e + f*x])^m*(a + b*Tan[e + f*x])^(n - 1))/(f*(m + n - 1)), x] + Dist[(a*(m + 2*n - 2))/(m + n - 1), Int[(
d*Sec[e + f*x])^m*(a + b*Tan[e + f*x])^(n - 1), x], x] /; FreeQ[{a, b, d, e, f, m, n}, x] && EqQ[a^2 + b^2, 0]
 && IGtQ[Simplify[m/2 + n - 1], 0] &&  !IntegerQ[n]

Rubi steps

\begin {align*} \int (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^n \, dx &=\frac {i a (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^{-1+n}}{d (3-n)}+\frac {(2 a) \int (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^{-1+n} \, dx}{3-n}\\ &=\frac {2 i a^2 (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^{-2+n}}{d \left (6-5 n+n^2\right )}+\frac {i a (e \sec (c+d x))^{4-2 n} (a+i a \tan (c+d x))^{-1+n}}{d (3-n)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 1.24, size = 91, normalized size = 0.93 \[ \frac {e^4 \sec ^2(c+d x) ((n-2) \tan (c+d x)-i (n-4)) (\cos (2 (c+d x))-i \sin (2 (c+d x))) (a+i a \tan (c+d x))^n (e \sec (c+d x))^{-2 n}}{d (n-3) (n-2)} \]

Antiderivative was successfully verified.

[In]

Integrate[(e*Sec[c + d*x])^(4 - 2*n)*(a + I*a*Tan[c + d*x])^n,x]

[Out]

(e^4*Sec[c + d*x]^2*(Cos[2*(c + d*x)] - I*Sin[2*(c + d*x)])*(a + I*a*Tan[c + d*x])^n*((-I)*(-4 + n) + (-2 + n)
*Tan[c + d*x]))/(d*(-3 + n)*(-2 + n)*(e*Sec[c + d*x])^(2*n))

________________________________________________________________________________________

fricas [A]  time = 0.68, size = 134, normalized size = 1.37 \[ \frac {{\left ({\left (-i \, n + 3 i\right )} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (-i \, n + 4 i\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + i\right )} \left (\frac {2 \, e e^{\left (i \, d x + i \, c\right )}}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}\right )^{-2 \, n + 4} e^{\left (i \, d n x + i \, c n - 4 i \, d x + n \log \left (\frac {2 \, e e^{\left (i \, d x + i \, c\right )}}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}\right ) + n \log \left (\frac {a}{e}\right ) - 4 i \, c\right )}}{2 \, {\left (d n^{2} - 5 \, d n + 6 \, d\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((e*sec(d*x+c))^(4-2*n)*(a+I*a*tan(d*x+c))^n,x, algorithm="fricas")

[Out]

1/2*((-I*n + 3*I)*e^(4*I*d*x + 4*I*c) + (-I*n + 4*I)*e^(2*I*d*x + 2*I*c) + I)*(2*e*e^(I*d*x + I*c)/(e^(2*I*d*x
 + 2*I*c) + 1))^(-2*n + 4)*e^(I*d*n*x + I*c*n - 4*I*d*x + n*log(2*e*e^(I*d*x + I*c)/(e^(2*I*d*x + 2*I*c) + 1))
 + n*log(a/e) - 4*I*c)/(d*n^2 - 5*d*n + 6*d)

________________________________________________________________________________________

giac [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (e \sec \left (d x + c\right )\right )^{-2 \, n + 4} {\left (i \, a \tan \left (d x + c\right ) + a\right )}^{n}\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((e*sec(d*x+c))^(4-2*n)*(a+I*a*tan(d*x+c))^n,x, algorithm="giac")

[Out]

integrate((e*sec(d*x + c))^(-2*n + 4)*(I*a*tan(d*x + c) + a)^n, x)

________________________________________________________________________________________

maple [F]  time = 2.04, size = 0, normalized size = 0.00 \[ \int \left (e \sec \left (d x +c \right )\right )^{4-2 n} \left (a +i a \tan \left (d x +c \right )\right )^{n}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((e*sec(d*x+c))^(4-2*n)*(a+I*a*tan(d*x+c))^n,x)

[Out]

int((e*sec(d*x+c))^(4-2*n)*(a+I*a*tan(d*x+c))^n,x)

________________________________________________________________________________________

maxima [B]  time = 1.26, size = 594, normalized size = 6.06 \[ \frac {8 \, {\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{2} \, n} a^{n} e^{4} \cos \left (n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right )\right ) + 8 i \, {\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{2} \, n} a^{n} e^{4} \sin \left (n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right )\right ) - 8 \, {\left (a^{n} e^{4} n - 3 \, a^{n} e^{4}\right )} {\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{2} \, n} \cos \left (2 \, d x + n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right ) + 2 \, c\right ) - {\left (8 i \, a^{n} e^{4} n - 24 i \, a^{n} e^{4}\right )} {\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{2} \, n} \sin \left (2 \, d x + n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right ) + 2 \, c\right )}{{\left ({\left (-i \, e^{2 \, n} n^{2} + 5 i \, e^{2 \, n} n - 6 i \, e^{2 \, n}\right )} 2^{n} \cos \left (6 \, d x + 6 \, c\right ) + {\left (-3 i \, e^{2 \, n} n^{2} + 15 i \, e^{2 \, n} n - 18 i \, e^{2 \, n}\right )} 2^{n} \cos \left (4 \, d x + 4 \, c\right ) + {\left (-3 i \, e^{2 \, n} n^{2} + 15 i \, e^{2 \, n} n - 18 i \, e^{2 \, n}\right )} 2^{n} \cos \left (2 \, d x + 2 \, c\right ) + {\left (e^{2 \, n} n^{2} - 5 \, e^{2 \, n} n + 6 \, e^{2 \, n}\right )} 2^{n} \sin \left (6 \, d x + 6 \, c\right ) + 3 \, {\left (e^{2 \, n} n^{2} - 5 \, e^{2 \, n} n + 6 \, e^{2 \, n}\right )} 2^{n} \sin \left (4 \, d x + 4 \, c\right ) + 3 \, {\left (e^{2 \, n} n^{2} - 5 \, e^{2 \, n} n + 6 \, e^{2 \, n}\right )} 2^{n} \sin \left (2 \, d x + 2 \, c\right ) + {\left (-i \, e^{2 \, n} n^{2} + 5 i \, e^{2 \, n} n - 6 i \, e^{2 \, n}\right )} 2^{n}\right )} d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((e*sec(d*x+c))^(4-2*n)*(a+I*a*tan(d*x+c))^n,x, algorithm="maxima")

[Out]

(8*(cos(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) + 1)^(1/2*n)*a^n*e^4*cos(n*arctan2(sin(2*d*x
+ 2*c), cos(2*d*x + 2*c) + 1)) + 8*I*(cos(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) + 1)^(1/2*n
)*a^n*e^4*sin(n*arctan2(sin(2*d*x + 2*c), cos(2*d*x + 2*c) + 1)) - 8*(a^n*e^4*n - 3*a^n*e^4)*(cos(2*d*x + 2*c)
^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) + 1)^(1/2*n)*cos(2*d*x + n*arctan2(sin(2*d*x + 2*c), cos(2*d*x +
2*c) + 1) + 2*c) - (8*I*a^n*e^4*n - 24*I*a^n*e^4)*(cos(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c
) + 1)^(1/2*n)*sin(2*d*x + n*arctan2(sin(2*d*x + 2*c), cos(2*d*x + 2*c) + 1) + 2*c))/(((-I*e^(2*n)*n^2 + 5*I*e
^(2*n)*n - 6*I*e^(2*n))*2^n*cos(6*d*x + 6*c) + (-3*I*e^(2*n)*n^2 + 15*I*e^(2*n)*n - 18*I*e^(2*n))*2^n*cos(4*d*
x + 4*c) + (-3*I*e^(2*n)*n^2 + 15*I*e^(2*n)*n - 18*I*e^(2*n))*2^n*cos(2*d*x + 2*c) + (e^(2*n)*n^2 - 5*e^(2*n)*
n + 6*e^(2*n))*2^n*sin(6*d*x + 6*c) + 3*(e^(2*n)*n^2 - 5*e^(2*n)*n + 6*e^(2*n))*2^n*sin(4*d*x + 4*c) + 3*(e^(2
*n)*n^2 - 5*e^(2*n)*n + 6*e^(2*n))*2^n*sin(2*d*x + 2*c) + (-I*e^(2*n)*n^2 + 5*I*e^(2*n)*n - 6*I*e^(2*n))*2^n)*
d)

________________________________________________________________________________________

mupad [B]  time = 5.93, size = 174, normalized size = 1.78 \[ \frac {4\,e^4\,{\left (\frac {a\,\left (\cos \left (2\,c+2\,d\,x\right )+1+\sin \left (2\,c+2\,d\,x\right )\,1{}\mathrm {i}\right )}{\cos \left (2\,c+2\,d\,x\right )+1}\right )}^n\,\left (4\,\sin \left (2\,c+2\,d\,x\right )+\cos \left (2\,c+2\,d\,x\right )\,4{}\mathrm {i}+\cos \left (4\,c+4\,d\,x\right )\,1{}\mathrm {i}-n\,1{}\mathrm {i}+\sin \left (4\,c+4\,d\,x\right )-n\,\cos \left (2\,c+2\,d\,x\right )\,1{}\mathrm {i}-n\,\sin \left (2\,c+2\,d\,x\right )+3{}\mathrm {i}\right )}{d\,{\left (\frac {e}{\cos \left (c+d\,x\right )}\right )}^{2\,n}\,\left (4\,\cos \left (2\,c+2\,d\,x\right )+\cos \left (4\,c+4\,d\,x\right )+3\right )\,\left (n^2-5\,n+6\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((e/cos(c + d*x))^(4 - 2*n)*(a + a*tan(c + d*x)*1i)^n,x)

[Out]

(4*e^4*((a*(cos(2*c + 2*d*x) + sin(2*c + 2*d*x)*1i + 1))/(cos(2*c + 2*d*x) + 1))^n*(cos(2*c + 2*d*x)*4i - n*1i
 + cos(4*c + 4*d*x)*1i + 4*sin(2*c + 2*d*x) + sin(4*c + 4*d*x) - n*cos(2*c + 2*d*x)*1i - n*sin(2*c + 2*d*x) +
3i))/(d*(e/cos(c + d*x))^(2*n)*(4*cos(2*c + 2*d*x) + cos(4*c + 4*d*x) + 3)*(n^2 - 5*n + 6))

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (e \sec {\left (c + d x \right )}\right )^{4 - 2 n} \left (i a \left (\tan {\left (c + d x \right )} - i\right )\right )^{n}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((e*sec(d*x+c))**(4-2*n)*(a+I*a*tan(d*x+c))**n,x)

[Out]

Integral((e*sec(c + d*x))**(4 - 2*n)*(I*a*(tan(c + d*x) - I))**n, x)

________________________________________________________________________________________